package stuManagement.dao.impl;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import stuManagement.dao.ClassesDao;
import stuManagement.entity.Classes;

public class ClassesDaoImpl extends HibernateDaoSupport implements ClassesDao {

	@Override
	public List<Classes> getAll() {
		return (List<Classes>)getHibernateTemplate().find("from Classes");
	}
	
	public static void main(String[] args) {
		ApplicationContext atx = new ClassPathXmlApplicationContext("beans.xml");
		ClassesDao dao = (ClassesDao)atx.getBean("classesDao");
		for(Classes c : dao.getAll())
			System.out.println(c.getName());
	}

}
